use Modern::Perl;
use Cwd;
use Test::More;

my $bg;
eval{
  no warnings;
  require POSIX;
  my $pgrp = POSIX::getpgrp();
  #note explain $pgrp;
  if (open my $tty,"</dev/tty"){
    my $p = POSIX::tcgetpgrp(fileno $tty);
    if ($p >=0  and $p != $pgrp){
      $bg = 1;
    }
  }else{
    my $p = POSIX::tcgetpgrp(0);
    if ($p >=0  and $p != $pgrp){
      $bg = 1;
    }
  }
};

print "##$bg##\n";
